﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutofacContrib.DynamicProxy2;
using System.Threading;

namespace Autofac
{
    [Intercept(typeof(StopWatchInterceptor))]
    public interface IUserService
    {
        void AddUser(string Name);
        string[] GetAll();
    }

    [Intercept(typeof(StopWatchInterceptor))]
    public class UserService
    {
        static List<string> users = new List<string>
        {
            "梅西","C罗","肥猫"
        };

        public virtual void AddUser(string Name)
        {
            users.Add(Name);
        }

        public virtual string[] GetAll()
        {
            users.ForEach(u => 
            {
                Console.WriteLine("Name:{0}", u);
            });
            Thread.Sleep(53);
            return users.ToArray();
        }
    }
}
